package com.jinghao.tws.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jinghao.core.common.controller.JingHaoBaseController;
import com.jinghao.tws.entity.WvFlow;
import com.jinghao.tws.entity.WvFlow.EWvFlow;
import com.jinghao.tws.service.IWvFlowService;

@Controller
@Scope("prototype")
@RequestMapping(value = "/app/tws/WvFlow")
public class WvFlowController extends JingHaoBaseController<WvFlow> {
	//==================定制内容开始======================
//在这里修改代码
	
	/**
	 * 所有流程列表
	 * @param  
	 */
	@ResponseBody
	@RequestMapping(value = "/listWvFlow",method = RequestMethod.GET) 
	public Map<String, Object> listWvFlow(@ModelAttribute("model") WvFlow model){
		this.getWvFlowService().listWvFlow(model);
        return model.getListJson();   
	} 
	/**
	 * 获取单个流程信息（包含环节信息）
	 * @param  
	 */
	@ResponseBody
	@RequestMapping(value = "/getSingleWvFlowInfo",method = RequestMethod.GET) 
	public Map<String, Object> getSingleWvFlowInfo(@ModelAttribute("model") WvFlow model){
		this.getWvFlowService().getSingleWvFlowInfo(model);
        return model.getSingleJson();   
	} 
	/**
	 * 新增流程列表
	 * @param  
	 */
	@ResponseBody
	@RequestMapping(value = "/addWvFlow",method = RequestMethod.POST) 
	public Map<String, Object> addWvFlow(@ModelAttribute("model") WvFlow model,@RequestBody Map<String,Object> map){
		model.setObjMap(map);
		this.getWvFlowService().addWvFlow(model); 
        return model.getJson();   
	} 
	/**
	 * 修改流程
	 * @param  
	 */
	@ResponseBody
	@RequestMapping(value = "/updateWvFlow",method = RequestMethod.POST) 
	public Map<String, Object> updateWvFlow(@ModelAttribute("model") WvFlow model,@RequestBody Map<String,Object> map){
		model.setObjMap(map);
		this.getWvFlowService().updateWvFlow(model);
        return model.getJson();   
	} 
	
	
	/**
	（批量）启用流程信息

	@param WvFlowService
	 */
	@ResponseBody
	@RequestMapping(value = "/updateEnableWvFlow",method = RequestMethod.GET) 
	public Map<String,Object> updateEnableWvFlow(@ModelAttribute("model") WvFlow model){
		model.setStatus(EWvFlow.status_1.getKey());
		this.getWvFlowService().updateWvFlowStatic(model);
		return model.getJson();  
	}

	/**
	（批量）禁用流程信息

	@param WvFlowService
	 */
	@ResponseBody
	@RequestMapping(value = "/updateDisableWvFlow",method = RequestMethod.GET) 
	public Map<String,Object> updateDisableWvFlow(@ModelAttribute("model") WvFlow model){
		model.setStatus(EWvFlow.status_0.getKey());
		this.getWvFlowService().updateWvFlowStatic(model);
		return model.getJson();  
	}

	/**
	（批量）删除流程信息

	@param WvFlowService
	 */
	@ResponseBody
	@RequestMapping(value = "/updateDeleteWvFlow",method = RequestMethod.GET) 
	public Map<String,Object> updateDeleteWvFlow(@ModelAttribute("model") WvFlow model){
		model.setStatus(EWvFlow.status_2.getKey());
		this.getWvFlowService().updateWvFlowStatic(model);
		return model.getJson();  
	}
	
	//==================定制内容结束======================

	@Autowired
	public void setWvFlowService(IWvFlowService wvFlowService) {
		super.setIJingHaoBaseService(wvFlowService);
	}

	public IWvFlowService getWvFlowService() {
		return (IWvFlowService) super.getIJingHaoBaseService();
	}
}
